﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.Web.UI;
using XCommunity.Documents.UBB;

namespace XCommunity.Documents
{
  public class UbbTextDocumentPlugin : TextDocumentPlugin
  {



    protected override void RenderDocument( TextDocument document, HtmlTextWriter writer )
    {

      var ubbDoucment = document["ParsedUbbDocument"] as UbbDocument;
      if ( ubbDoucment == null )
        document["ParsedUbbDocument"] = ubbDoucment = new UbbParser( UbbProvider.GetProvider() ).ParseDocument( document.GetContent() );


      UbbRender render = new UbbRender( writer );

      render.RenderDocument( ubbDoucment );
    }
  }
}
